﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Modules.quest.guide {
    import Engine.Managers.*;
    import flash.display.*;
    import flash.geom.*;
    import flash.utils.*;
    import Modules.quest.Managers.*;
    import Modules.guide.*;
    import Modules.quest.guide.ui.*;

    public class QuestGuide extends Guide {

        protected var m_quest:GameQuest;

        public function QuestGuide(_arg1:XML, _arg2:GameQuest){
            m_triggers = new Dictionary();
            m_callbacks = new Dictionary();
            m_names = new Dictionary();
            m_sequences = new Dictionary();
            m_arrows = new Array();
            m_dialogs = new Array();
            m_guideTiles = new Array();
            m_callbackHelper = new GuideCallbackHelper();
            m_callbackHelper.registerHandlers(this);
            m_reader = new QuestGuideActionReader(this, _arg1, _arg2);
            m_reader.readActions();
            this.m_quest = _arg2;
        }
        override public function registerSequence(_arg1:GuideSequence):void{
            if (_arg1 != null){
                if (m_sequences[_arg1.m_name] == null){
                    m_sequences[_arg1.m_name] = _arg1;
                    registerTrigger(_arg1.m_name, _arg1);
                };
            };
        }
        override public function notify(_arg1:String):void{
            var _local3:GuideSequence;
            if ((((_arg1 == null)) || ((_arg1.length < 1)))){
                return;
            };
            var _local2:Array = m_triggers[_arg1];
            if (_local2 != null){
                for each (_local3 in _local2) {
                    if (_local3.isActive()){
                        _local3.stop();
                    };
                };
                for each (_local3 in _local2) {
                    _local3.start();
                };
            };
        }
        override public function displaySpotLight(_arg1:DisplayObjectContainer, _arg2:Point, _arg3:Point, _arg4:int, _arg5:int, _arg6:Number=0, _arg7:Boolean=false):void{
            if (m_mask != null){
                ErrorManager.addError("Spotlight applied twice!");
                return;
            };
            if (_arg1 == null){
                ErrorManager.addError("Failed to attach spotlight!");
            };
            m_mask = new QuestGuideMask((getActiveSequence() as QuestGuideSequence));
            m_mask.displaySpotLight(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7);
            disableZoom();
        }

    }
}//package Modules.quest.guide 
